import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
    children: [
      {
        path: "page1",
        name: "page1",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import("../views/page1/index.vue"),
        children: [
          {
            path: "screen1",
            name: "screen1",
            // route level code-splitting
            // this generates a separate chunk (about.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import("../views/page1/screen1/index.vue")
          },
          {
            path: "screen2",
            name: "screen2",
            // route level code-splitting
            // this generates a separate chunk (about.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import("../views/page1/screen2/index.vue")
          }
        ]
      },
      {
        path: "page2",
        name: "page2",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import("../views/page2/index.vue"),
        children: [
          {
            path: "screen2",
            name: "screen2",
            // route level code-splitting
            // this generates a separate chunk (about.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import("../views/page2/screen2/index.vue")
          },
          {
            path: "screen1",
            name: "screen1",
            // route level code-splitting
            // this generates a separate chunk (about.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import("../views/page2/screen1/index.vue")
          },
          {
            path: "screen3",
            name: "screen3",
            // route level code-splitting
            // this generates a separate chunk (about.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import("../views/page2/screen3/index.vue")
          }
        ]
      }
    ]
  }
];

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
});

export default router;
